<?php session_start();?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<link href="css/style.css" type="text/css" rel="stylesheet">
<link href="css/myStyle.css" type="text/css" rel="stylesheet">
<link href="css/facebook div styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.watermarkinput.js"></script>
<?php
$visib="none";
$visib2="none";
if($_POST["username"]&&$_POST["password"]){
	require("_config-rating.php");
	
	if($_GET["ref"]){
		$refPage=$_GET["ref"];
	}
	
	$username=$_POST["username"];
	$password=$_POST["password"];
	
	mysql_query("SET NAMES 'utf8'");
	$sql = "SELECT userId FROM users where userName = '$username' and userPass='$password'"; 
	$rs_result = mysql_query ($sql,$con); 
	if($row = mysql_fetch_array($rs_result) ){
		//yonlendir("index.php",0);
		if($row["userId"]){
			//////////////////////session bölümü//////////////////////////
			//session_start();
			$_SESSION["user_name"] = $username;
			////////////////////////////////////////////////
			
			$visib2="block";
			$error2="Giriş başarılı!";
			if($_GET["ref"]){
				yonlendir($_GET["ref"],0);
			}
			
		}
		else{
			$visib="block";
			$error="Kullanıcı adı veya şifre yanlış!";
		}
		
	}else{
		$visib="block";
		$error="Kullanıcı adı veya şifre yanlış!";
	}
	
	mysql_close();
	

}

function yonlendir($adres, $zaman = 0)
{
    if (!headers_sent()) {
        header('refresh: ' . $zaman . '; url=' . $adres);
    } else {
        echo '<meta http-equiv="refresh" content="'.$zaman.';url='.$adres.'" />';
    }
} 
?>
</head>
<body>
<div id="header" style="margin-top:-23px;">
	<?php include("header.php");?>
</div>

<div id="contentArea">
    <?php include("leftSideMenu.html");?>
    <div style="width:380px;float:left;border-right:1px solid #DDDDDD;height:100%;margin-top:30px;margin-bottom:50px;">
		<table>
		<tr>
		<td>
			<img src="images/businessman_woman.png"/>
		</td>
		<td>
		<div id="mailInfo" style="font-size:11px;font-style:italic">Sisteme kayıt olarak favori oyunlarınızı kaydedebilir, oyun listeleri 
oluþturabilir ve 
	istediğiniz her an bu listelerden beğendiğiniz oyunları seçip oynayabilirsiniz.</div>
		</td>
		</tr>
	</table>
    </div>
	<div style="width:400px;float:right;margin:50 0 0 30px;">
    <div  class="fb5" style="width:177px;display:<?php echo $visib;?>"><?php echo $error;?></div>
    <div  class="fb4" style="width:177px;display:<?php echo $visib2;?>"><?php echo $error2;?></div>
   	<form id="listGame" name="listGame" method="post">
      <label style="width:300px;">Kullanıcı Adı :
      <br>
      <input type="text" name="username" style="width:200px;"/>
      </label>
      <br>
      <br>
      <label style="width:300px;">Şifre :
      <br>
      <input type="password" name="password" style="width:200px;"/>
      </label>
      <br>
      <br>
      <label style="width:300px;">E-mail :
      <br>
      <input type="text" name="e-mail" style="width:200px;"/>
      <br>
      <span id="mailInfo" style="font-size:9px;font-style:italic">E-mail adresiniz gizli tutulacaktır.</span>
      </label>
      
      <br>
      <br>
      <input type="submit" value="Kayıt Ol" name="gameListSearch" >
      
      <br>
      </form>
	</div>
</div>
<div id="footer"><?php include("footer.php");?></div>
</body>
</html>